<html>
<head><meta charset="utf-8"><title>unroll_place questions · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html">unroll_place questions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="159540945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159540945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159540945">(Feb 27 2019 at 18:43)</a>:</h4>
<p>I have a couple of questions related to <code>unroll_place</code></p>



<a name="159541032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541032">(Feb 27 2019 at 18:44)</a>:</h4>
<p>I was starting to talk with <span class="user-mention" data-user-id="116009">@nikomatsakis</span> about this, but I figure that's better for a separate topic</p>



<a name="159541122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541122">(Feb 27 2019 at 18:45)</a>:</h4>
<p>first, <code>PlaceComponentIter</code> is not really an iterator</p>



<a name="159541132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541132">(Feb 27 2019 at 18:45)</a>:</h4>
<p>I can live with it</p>



<a name="159541135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541135">(Feb 27 2019 at 18:45)</a>:</h4>
<p>was just wondering</p>



<a name="159541142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541142">(Feb 27 2019 at 18:45)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/ea43c3c688980edd6f09a4cb632c9eb996c4f2af/src/librustc_mir/borrow_check/places_conflict.rs#L304-L309" target="_blank" title="https://github.com/rust-lang/rust/blob/ea43c3c688980edd6f09a4cb632c9eb996c4f2af/src/librustc_mir/borrow_check/places_conflict.rs#L304-L309">https://github.com/rust-lang/rust/blob/ea43c3c688980edd6f09a4cb632c9eb996c4f2af/src/librustc_mir/borrow_check/places_conflict.rs#L304-L309</a></p>



<a name="159541248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541248">(Feb 27 2019 at 18:46)</a>:</h4>
<p>I wonder, when and why do you want to keep executing when you get <code>None</code>?</p>



<a name="159541258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541258">(Feb 27 2019 at 18:46)</a>:</h4>
<p>and why you can't do that with an real iterator</p>



<a name="159541389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541389">(Feb 27 2019 at 18:48)</a>:</h4>
<p>I guess you can but you would allow the usage of <code>for x in iter</code> and that's not what you want given that you want to do something even when the thing returns <code>None</code> and with <code>for</code> syntax you won't be in the loop anymore if it returns <code>None</code>? I guess that's what the text is referring to?</p>



<a name="159541392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541392">(Feb 27 2019 at 18:48)</a>:</h4>
<p>ah</p>



<a name="159541398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541398">(Feb 27 2019 at 18:48)</a>:</h4>
<p>well, you <em>can</em> do that with a real iterator</p>



<a name="159541425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541425">(Feb 27 2019 at 18:48)</a>:</h4>
<p>in <strong>general</strong>, the <code>Iterator</code> trait does not guarantee what happens once <code>None</code> is returned</p>



<a name="159541433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541433">(Feb 27 2019 at 18:49)</a>:</h4>
<p>but for any <strong>given</strong> iterator, you may have guarantees</p>



<a name="159541448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541448">(Feb 27 2019 at 18:49)</a>:</h4>
<p>(and in particular, you can invoke <code>fuse</code> to get an iterator that is guaranteed to be a no-op, if needed -- it wouldn't be here)</p>



<a name="159541449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541449">(Feb 27 2019 at 18:49)</a>:</h4>
<p>but in any case</p>



<a name="159541465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541465">(Feb 27 2019 at 18:49)</a>:</h4>
<blockquote>
<p>in <strong>general</strong>, the <code>Iterator</code> trait does not guarantee what happens once <code>None</code> is returned</p>
</blockquote>
<p>ahh ok, I was assuming that it keeps returning <code>None</code>, could even panic I guess but checking that has perf implications</p>



<a name="159541535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541535">(Feb 27 2019 at 18:50)</a>:</h4>
<p>I think that <a href="https://github.com/rust-lang/rust/blob/ea43c3c688980edd6f09a4cb632c9eb996c4f2af/src/librustc_mir/borrow_check/places_conflict.rs#L244-L247" target="_blank" title="https://github.com/rust-lang/rust/blob/ea43c3c688980edd6f09a4cb632c9eb996c4f2af/src/librustc_mir/borrow_check/places_conflict.rs#L244-L247">this code</a> is the case we want to keep going</p>



<a name="159541562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541562">(Feb 27 2019 at 18:50)</a>:</h4>
<p>i.e., if you borrowed <code>x</code> but accessed <code>*x.y</code></p>



<a name="159541609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541609">(Feb 27 2019 at 18:51)</a>:</h4>
<p>ahh ok</p>



<a name="159541624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541624">(Feb 27 2019 at 18:51)</a>:</h4>
<p>so unroll is not really a general purpose thing to iterate over <code>Place</code></p>



<a name="159541633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541633">(Feb 27 2019 at 18:51)</a>:</h4>
<p>it's just a convenience for the conflicts thing</p>



<a name="159541634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541634">(Feb 27 2019 at 18:51)</a>:</h4>
<p>then the returns would be something like:</p>
<ul>
<li>Round 1:<br>
    - borrow gives <code>Some(x)</code><br>
    - access gives <code>Some(x)</code></li>
<li>Round 2:<br>
    - borrow gives <code>None</code><br>
    - access gives <code>Some(.y)</code></li>
<li>Round 3:<br>
    - borrow gives <code>None</code><br>
    - access gives <code>Some(*)</code></li>
</ul>



<a name="159541683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541683">(Feb 27 2019 at 18:52)</a>:</h4>
<p>anyway I forget exactly but in some cases I guess that may turn out ok, in others not</p>



<a name="159541690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541690">(Feb 27 2019 at 18:52)</a>:</h4>
<blockquote>
<p>so unroll is not really a general purpose thing to iterate over <code>Place</code></p>
</blockquote>
<p>well, yes and no</p>



<a name="159541697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541697">(Feb 27 2019 at 18:52)</a>:</h4>
<p>I mean it was not meant for "general use"</p>



<a name="159541701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541701">(Feb 27 2019 at 18:52)</a>:</h4>
<p>but really it <em>does</em> just let you iterate</p>



<a name="159541707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541707">(Feb 27 2019 at 18:52)</a>:</h4>
<p>yep</p>



<a name="159541709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541709">(Feb 27 2019 at 18:52)</a>:</h4>
<p>so it <em>could</em> be used generally</p>



<a name="159541711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541711">(Feb 27 2019 at 18:52)</a>:</h4>
<p>but I probably prefer something else</p>



<a name="159541715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541715">(Feb 27 2019 at 18:52)</a>:</h4>
<p>well I guess it depends</p>



<a name="159541727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541727">(Feb 27 2019 at 18:52)</a>:</h4>
<p>anyway, let me go to the next question :)</p>



<a name="159541728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541728">(Feb 27 2019 at 18:52)</a>:</h4>
<p>but the conflict checking really <em>does</em> want to ensure that <code>None</code> keeps getting returned</p>



<a name="159541736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541736">(Feb 27 2019 at 18:53)</a>:</h4>
<p>(you can certainly achieve that constraint)</p>



<a name="159541876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541876">(Feb 27 2019 at 18:54)</a>:</h4>
<p>so, all this is motivated by using <code>unroll</code> as an <code>iterate</code> method for <code>Place</code> and then keep moving to <code>Place 2.0</code></p>



<a name="159541916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541916">(Feb 27 2019 at 18:55)</a>:</h4>
<p>thing is ... look at how it looks like the code for <code>fn ty</code> using <code>unroll</code></p>



<a name="159541931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159541931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159541931">(Feb 27 2019 at 18:55)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="mi">157</span><span class="w">     </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">ty</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;gcx</span><span class="p">,</span><span class="w"> </span><span class="n">D</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">local_decls</span>: <span class="kp">&amp;</span><span class="nc">D</span><span class="p">,</span><span class="w"> </span><span class="n">tcx</span>: <span class="nc">TyCtxt</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;gcx</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">PlaceTy</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"></span>
<span class="mi">158</span><span class="w">         </span><span class="k">where</span><span class="w"> </span><span class="n">D</span>: <span class="nc">HasLocalDecls</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"></span>
<span class="mi">159</span><span class="w">     </span><span class="p">{</span><span class="w"></span>
<span class="mi">160</span><span class="w">         </span><span class="bp">self</span><span class="p">.</span><span class="n">unroll</span><span class="p">(</span><span class="nb">None</span><span class="p">,</span><span class="w"> </span><span class="o">|</span><span class="k">mut</span><span class="w"> </span><span class="n">place_components</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="mi">161</span><span class="w">             </span><span class="kd">let</span><span class="w"> </span><span class="n">base</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">place_components</span><span class="p">.</span><span class="n">next</span><span class="p">().</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>
<span class="mi">162</span><span class="w">             </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">place_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="o">*</span><span class="n">base</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="mi">163</span><span class="w">                 </span><span class="n">Place</span>::<span class="n">Base</span><span class="p">(</span><span class="n">PlaceBase</span>::<span class="n">Local</span><span class="p">(</span><span class="n">index</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"></span>
<span class="mi">164</span><span class="w">                     </span><span class="n">PlaceTy</span>::<span class="n">Ty</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">ty</span>: <span class="nc">local_decls</span><span class="p">.</span><span class="n">local_decls</span><span class="p">()[</span><span class="n">index</span><span class="p">].</span><span class="n">ty</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="mi">165</span><span class="w">                 </span><span class="n">Place</span>::<span class="n">Base</span><span class="p">(</span><span class="n">PlaceBase</span>::<span class="n">Promoted</span><span class="p">(</span><span class="k">ref</span><span class="w"> </span><span class="n">data</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">PlaceTy</span>::<span class="n">Ty</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">ty</span>: <span class="nc">data</span><span class="p">.</span><span class="mi">1</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="mi">166</span><span class="w">                 </span><span class="n">Place</span>::<span class="n">Base</span><span class="p">(</span><span class="n">PlaceBase</span>::<span class="n">Static</span><span class="p">(</span><span class="k">ref</span><span class="w"> </span><span class="n">data</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"></span>
<span class="mi">167</span><span class="w">                     </span><span class="n">PlaceTy</span>::<span class="n">Ty</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">ty</span>: <span class="nc">data</span><span class="p">.</span><span class="n">ty</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="mi">168</span><span class="w">                 </span><span class="n">Place</span>::<span class="n">Projection</span><span class="p">(</span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"></span>
<span class="mi">169</span><span class="w">                     </span><span class="n">bug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;This should be a base place&quot;</span><span class="p">),</span><span class="w"></span>
<span class="mi">170</span><span class="w">             </span><span class="p">};</span><span class="w"></span>
<span class="mi">171</span><span class="w"></span>
<span class="mi">172</span><span class="w">             </span><span class="c1">// apply .projection_ty() to all elems but only returns the final one.</span>
<span class="mi">173</span><span class="w">             </span><span class="k">while</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">elem</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">place_components</span><span class="p">.</span><span class="n">next</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="mi">174</span><span class="w">                 </span><span class="k">match</span><span class="w"> </span><span class="n">elem</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="mi">175</span><span class="w">                     </span><span class="n">Place</span>::<span class="n">Base</span><span class="p">(</span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"></span>
<span class="mi">176</span><span class="w">                         </span><span class="n">bug</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;This should be a projection place&quot;</span><span class="p">),</span><span class="w"></span>
<span class="mi">177</span><span class="w">                     </span><span class="n">Place</span>::<span class="n">Projection</span><span class="p">(</span><span class="k">ref</span><span class="w"> </span><span class="n">proj</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"></span>
<span class="mi">178</span><span class="w">                         </span><span class="n">place_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">place_ty</span><span class="p">.</span><span class="n">projection_ty</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">proj</span><span class="p">.</span><span class="n">elem</span><span class="p">),</span><span class="w"></span>
<span class="mi">179</span><span class="w">                 </span><span class="p">}</span><span class="w"></span>
<span class="mi">180</span><span class="w">             </span><span class="p">}</span><span class="w"></span>
<span class="mi">181</span><span class="w"></span>
<span class="mi">182</span><span class="w">             </span><span class="n">place_ty</span><span class="w"></span>
<span class="mi">183</span><span class="w">         </span><span class="p">})</span><span class="w"></span>
<span class="mi">184</span><span class="w">     </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="159542034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542034">(Feb 27 2019 at 18:56)</a>:</h4>
<p>that's why I meant, that I'd prefer having an iterator that returns projections only</p>



<a name="159542036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542036">(Feb 27 2019 at 18:56)</a>:</h4>
<p>so first I ask for base</p>



<a name="159542042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542042">(Feb 27 2019 at 18:56)</a>:</h4>
<p>and then I iterate</p>



<a name="159542043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542043">(Feb 27 2019 at 18:56)</a>:</h4>
<p>like in</p>



<a name="159542052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542052">(Feb 27 2019 at 18:56)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">ty</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;gcx</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">local_decls</span>: <span class="kp">&amp;</span><span class="nc">impl</span><span class="w"> </span><span class="n">HasLocalDecls</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">tcx</span>: <span class="nc">TyCtxt</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;gcx</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">PlaceTy</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">place_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">PlaceTy</span>::<span class="n">from</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">base</span><span class="p">.</span><span class="n">ty</span><span class="p">(</span><span class="n">local_decls</span><span class="p">));</span><span class="w"></span>

<span class="w">        </span><span class="c1">// apply .projection_ty() to all elems but only returns the final one.</span>
<span class="w">        </span><span class="k">for</span><span class="w"> </span><span class="n">elem</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">elems</span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">place_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">place_ty</span><span class="p">.</span><span class="n">projection_ty</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">elem</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>

<span class="w">        </span><span class="n">place_ty</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="159542397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542397">(Feb 27 2019 at 19:01)</a>:</h4>
<p>I can have a base and projection methods, they probably already exist, but still ...</p>



<a name="159542832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542832">(Feb 27 2019 at 19:06)</a>:</h4>
<p>I see</p>



<a name="159542891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542891">(Feb 27 2019 at 19:06)</a>:</h4>
<p>It seems fairly straightforward to adapt <code>unroll_place</code> in this way, <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span></p>



<a name="159542933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542933">(Feb 27 2019 at 19:07)</a>:</h4>
<p>and of course if you had such an iterator</p>



<a name="159542952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542952">(Feb 27 2019 at 19:07)</a>:</h4>
<p>you could trivially use it to reproduce the existing <code>unroll_place</code> interface</p>



<a name="159542961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542961">(Feb 27 2019 at 19:07)</a>:</h4>
<p>e.g., I believe I saw something about getting a callback like <code>(base, projections_iter)</code></p>



<a name="159542964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542964">(Feb 27 2019 at 19:07)</a>:</h4>
<p>you mean, having unroll_place returning a struct that gives you base and elems in different fields</p>



<a name="159542979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542979">(Feb 27 2019 at 19:07)</a>:</h4>
<p>something like that</p>



<a name="159542985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159542985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159542985">(Feb 27 2019 at 19:07)</a>:</h4>
<p>it may worth playing with it I guess</p>



<a name="159543067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159543067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159543067">(Feb 27 2019 at 19:08)</a>:</h4>
<p>in which case we could do <code>Some(Place::Base(base)).chain(projections_iter.map(PlaceProjection))</code> or something like that</p>



<a name="159543099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159543099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159543099">(Feb 27 2019 at 19:08)</a>:</h4>
<blockquote>
<p>you mean, having unroll_place returning a struct that gives you base and elems in different fields</p>
</blockquote>
<p>the document had an API in which you got a callback with two arguments</p>



<a name="159543119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159543119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159543119">(Feb 27 2019 at 19:08)</a>:</h4>
<p>in contrast to the <code>unroll_place</code> API, which calls you back with one (unified) iterator</p>



<a name="159543137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159543137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159543137">(Feb 27 2019 at 19:09)</a>:</h4>
<p>in any case either seems fine</p>



<a name="159546985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159546985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159546985">(Feb 27 2019 at 19:54)</a>:</h4>
<blockquote>
<blockquote>
<p>you mean, having unroll_place returning a struct that gives you base and elems in different fields</p>
</blockquote>
<p>the document had an API in which you got a callback with two arguments</p>
</blockquote>
<p>btw, which document?</p>



<a name="159551154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159551154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159551154">(Feb 27 2019 at 20:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> I meant the dropbox paper from the all hands</p>



<a name="159551556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159551556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159551556">(Feb 27 2019 at 20:57)</a>:</h4>
<p>ahh the one from the all hands</p>



<a name="159586114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/159586114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#159586114">(Feb 28 2019 at 07:52)</a>:</h4>
<p>This is partially why I wanted to have Place be a struct with the base field and a projection-tree field. Many place uses only care about the base, or care about it first and then about the other projections</p>



<a name="160517169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/unroll_place%20questions/near/160517169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/unroll_place.20questions.html#160517169">(Mar 11 2019 at 20:54)</a>:</h4>
<blockquote>
<p>(and in particular, you can invoke <code>fuse</code> to get an iterator that is guaranteed to be a no-op, if needed -- it wouldn't be here)</p>
</blockquote>
<p>FWIW, it's better to always call <code>.fuse()</code> if you need the behavior, and implement <a href="https://doc.rust-lang.org/std/iter/trait.FusedIterator.html" target="_blank" title="https://doc.rust-lang.org/std/iter/trait.FusedIterator.html"><code>FusedIterator</code></a> for your iterator if it will always return <code>None</code> after the first.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>